package com.design.mode.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-04-08 10:17:53
 */
public class College extends OrgComponent {

    private final List<OrgComponent> list = new ArrayList<>();

    public College(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrgComponent component) {
        list.add(component);
    }

    @Override
    protected void delete(OrgComponent component) {
        list.remove(component);
    }

    @Override
    protected void print() {
        System.out.println("College = " + getName());
        for (OrgComponent component : list) {
            component.print();
        }
    }
}
